import 'package:flutter/material.dart';
// 心得页面的分类导航

class ClassifyNavigation extends StatefulWidget {
  @override
  _ClassifyNavigationState createState() => _ClassifyNavigationState();
}

class _ClassifyNavigationState extends State<ClassifyNavigation> {
  // todo
  // fetch classify from server or local

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 100,
      child: ListView.builder(
        itemBuilder: _buildItem,
        itemCount: 10,
        scrollDirection: Axis.horizontal,
      ),
    );
  }

  Widget _buildItem(BuildContext context, int index) {
    return GestureDetector(
      child: Container(
        margin: const EdgeInsets.all(8.0),
        height: 90,
        width: 140,
        color: Colors.blue,
        child: Image.network(
          "https://avatars1.githubusercontent.com/u/46526052?s=400&u=b0f64fc2f67c45c17341d0090120d1e23f6b6478&v=4",
          fit: BoxFit.cover,
          filterQuality: FilterQuality.medium,
          colorBlendMode: BlendMode.dstOut,
        ),
      ),
      // 点击事件
      onTap: () {
        print("这里应该导航到对相应的 page view view ");
        // todo  点击导航到对应的页面

        Scaffold.of(context).showSnackBar(
          SnackBar(
            content: Container(
              child: Text("this this content.....", style: TextStyle(color: Colors.white, fontSize: 16.0),),
            ),
            duration: Duration(seconds: 2),
            backgroundColor: Colors.black,
          ),
        );
      },
    );
  }
}
